const { DataTypes } = require('sequelize')

const seq = require('../db/seq')


const Goods = seq.define('pet_goods', {
  cover: {
    type: DataTypes.TEXT,
    allowNull: false,
    comment: '封面'
  },
  type: {
    type: DataTypes.ENUM('玩具', '狗粮', '狗窝', '服饰'),
    allowNull: false,
    comment: '分类'
  },
  category: {
    type: DataTypes.STRING,
    allowNull: false,
    comment: '小分类'
  },
  start: {
    type: DataTypes.CHAR(1),
    defaultValue: 5,
    comment: '推荐指数'
  },
  name: {
    type: DataTypes.STRING,
    allowNull: false,
    comment: '商品名字'
  },
  scription: {
    type: DataTypes.STRING,
    allowNull: false,
    comment: '简介'
  },
  size: {
    type: DataTypes.STRING,
    allowNull: true,
    comment: '大小'
  },
  color: {
    type: DataTypes.STRING,
    allowNull: true,
    comment: '颜色'
  },
  number: {
    type: DataTypes.CHAR,
    allowNull: false,
    defaultValue: 0,
    comment: '商品数量',
  },
  tag: {
    type: DataTypes.STRING,
    allowNull: true,
    comment: '标签'
  },
  banner: {
    type: DataTypes.STRING,
    allowNull: false,
    comment: '轮播'
  },
  price: {
    type: DataTypes.DECIMAL(5,2),
    allowNull:false,
    comment:'价格'
  }
})


// Goods.sync({ force: true })  


module.exports = Goods